﻿using System.Security.Cryptography;
using System.Text;

namespace Lucas.Wendell.PI.Model.Utils
{
    public static class UtilsMethods
    {
        public static string GetMd5(string text)
        {
            MD5CryptoServiceProvider x = new MD5CryptoServiceProvider();
            byte[] bs = Encoding.UTF8.GetBytes(text);
            StringBuilder s = new StringBuilder();

            bs = x.ComputeHash(bs);

            foreach (byte b in bs)
                s.Append(b.ToString("x2").ToLower());

            return s.ToString();
        }

        public static string MaximoCaracteres(string campo, int quantidade)
        {
            return string.Format("Campo {0} - Máximo de {1} caracteres.", campo, quantidade);
        }

        public static string CampoObrigatorio(string campo)
        {
            return string.Format("Campo {0} obrigatório.", campo);
        }
    }
}
